<?php
/**
 * author        : ${USER}
 * createTime    : 2021/11/14 09:33
 * version       : 1.0
 * filename      : ProductResource.php
 */

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class ProductResource extends JsonResource
{
    /**
     * @param Request $request
     * @return array
     */
    public function toArray($request)
    {
        return parent::toArray($request) + [
                'category_name' => $this->category->name
            ];
    }
}
